# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ttf-liberation
pkgver=2.00.5
# Note: 2.00.0 onward releases does not includes Liberation Sans Narrow font due to licensing problems.
# we use narrowver to grab older release which does include narrow fonts
_narrowver=1.07.6
pkgrel=0
pkgdesc="Red Hat's Liberation fonts"
url="https://pagure.io/liberation-fonts/"
license="custom GPL-2.0"
arch="noarch"
depends="fontconfig"
options="!check"
# added fontconfig configuration from:
# https://github.com/bohoomil/fontconfig-ultimate/tree/master/fontconfig_patches/fonts-settings
source="
	https://github.com/liberationfonts/liberation-fonts/files/2926169/liberation-fonts-ttf-$pkgver.tar.gz
	https://github.com/liberationfonts/liberation-sans-narrow/files/2579431/liberation-narrow-fonts-ttf-$_narrowver.tar.gz
	30-liberation-mono.conf
	30-liberation-sans-narrow.conf
	30-liberation-sans.conf
	30-liberation-serif.conf
	45-liberation.conf
	90-tt-liberation.conf"

package() {
	mkdir -p "$pkgdir"/usr/share/fonts/$pkgname \
		"$pkgdir"/etc/fonts/conf.avail \
		"$pkgdir"/etc/fonts/conf.d

	install -m644 "$srcdir"/liberation-narrow-fonts-ttf-$_narrowver/*.ttf \
		"$pkgdir"/usr/share/fonts/$pkgname

	install -m644 "$srcdir"/liberation-fonts-ttf-$pkgver/*.ttf \
		"$pkgdir"/usr/share/fonts/$pkgname

	for j in "$srcdir"/*.conf; do
		install -m644 "$j" \
			"$pkgdir"/etc/fonts/conf.avail/
		cd "$pkgdir"/etc/fonts/conf.d
		ln -sf /etc/fonts/conf.avail/${j##*/}
	done
}

sha512sums="fc00494842475d040c01029b6fb134fec9a37516a5e8e1b9ba945a2b38fe2ef3df6a0acfc00dc024cf2019f1106092d063c8322eece1be1cf8690db4ed8a653f  liberation-fonts-ttf-2.00.5.tar.gz
bea2b8af3eaf32cc57faf1a582fdbef0ba3f2d5c2d9615f3c83c6b5aaac37856a25147cab26c3b18c3dca1b109b2a853874f5876dd6ae614676db3118f1bb804  liberation-narrow-fonts-ttf-1.07.6.tar.gz
585b74555132098d1d89b118b92fb843471ae2882622dec16178f8e7690fe6b5d8bf46e27e59fc3324aebfbd52a4b511d2ad77a8ddf8ef319cbe89b1a2dac91a  30-liberation-mono.conf
cf017383d4390d52bef7c79abb2f48fc4440880ca03ee4dc11647ced524e45a944c4c3e3b318837bef9632b5aa1445e8f29e87f2ea195a8a47899cdeef67aae7  30-liberation-sans-narrow.conf
4983c7be59b451d9f5aec7ca0502155ca0307cc8e8e96da02de36d4b665fd45834da359131f2bc83d579e586e0f1b2158fba0036f3c7c10f6d1ff34f0407c03b  30-liberation-sans.conf
3d54b6e92159860f16fef48e342bb46badb17d43f0f818a100e5e2fb344da77d7dc999ae35a6986dbb202d4e4423a102f4e100d6f3d67a72e604538c63e44178  30-liberation-serif.conf
f1fd84174404a7deaf519c1084f8f0a6ca411dcff18e095ac1fa866366c42222c0833c7381400db9a73b5a354019f7be22caac82d711215c376527ec9fa11922  45-liberation.conf
a56f9758166963f7896811a4ced35be08285c444499991006998de52d8edc6d413588511a529938fe630ef224b921ce06cf2f56e2f4a2a160ec9805605c7d326  90-tt-liberation.conf"
